home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 15 / Amiga Plus Leser CD 15.iso / Tools / Hardware / BlizKick / Modules / RebootFix.ASM < prev    next >
Encoding:
Assembly Source File  |  2002-03-13  |  2.8 KB  |  134 lines

  1. ; FILE: Source:modules/RebootFix.ASM          REV: 9 --- Fix problem with multisync reboot
  2.  
  3. ;
  4. ; RebootFix module for BlizKick
  5. ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  6. ;
  7. ; V1.3 - 5th Aug 2000
  8. ; Fucked up if the module patch was installed inside ROM. Fixed.
  9. ;
  10. ; V1.4 - 31st Jan 2001
  11. ; Added support for exec44 coldstart.
  12. ;
  13. ; Written by Harry Sintonen.
  14. ; This source code is Public Domain.
  15. ;
  16. ;
  17.  
  18.     incdir    "include:"
  19.     include    "blizkickmodule.i"
  20.  
  21.  
  22.     SECTION    PATCH,CODE
  23. _DUMMY_LABEL
  24.     BK_PTC
  25.  
  26. ; Code is run with following incoming parameters:
  27. ;
  28. ; a0=ptr to ROM start (buffer)    eg. $1DE087B8
  29. ; a1=ptr to ROM start (ROM)    eg. $00F80000 (do *not* access!)
  30. ; d0=ROM lenght in bytes    eg. $00080000
  31. ; a2=ptr to _FindResident routine (will search ROM buffer for resident tag):
  32. ;    CALL: jsr (a2)
  33. ;      IN: a0=ptr to ROM, d0=rom len, a1=ptr to resident name
  34. ;     OUT: d0=ptr to resident (buf) or NULL
  35. ; a3=ptr to _InstallModule routine (can be used to plant a "module"):
  36. ;    CALL: jsr (a3)
  37. ;      IN: a0=ptr to ROM, d0=rom len, a1=ptr to module, d6=dosbase
  38. ;     OUT: d0=success
  39. ; a4=ptr to _Printf routine (will dump some silly things (errormsg?) to stdout ;-)
  40. ;    CALL: jsr (a4)
  41. ;      IN: a0=FmtString, a1=Array (may be 0), d6=dosbase
  42. ;     OUT: -
  43. ; d6=dosbase, a6=execbase
  44. ;
  45. ; Code should return:
  46. ;
  47. ; d0=true if succeeded, false if failed.
  48. ; d1-d7/a0-a6 can be trashed. a7 *must* be preserved! ;-)
  49.  
  50.     cmp.w    #37,($C,a0)        ;requires V37+ rom image
  51.     bhs.b    .cont
  52.     moveq    #0,d0
  53.     rts
  54.  
  55. .cont    moveq    #0,d7
  56.  
  57.     move.l    a0,a5
  58.     move.l    #$397C0200,d1    ;$0100  move.w #$200,($0100,a4)
  59.     move.l    #$317C0200,d2    ;$0064  move.w #$200,($0064,a0)
  60.     move.w    #512-1,d3
  61. .findl    subq.w    #1,d3
  62.     beq.b    .badrom
  63.     addq.l    #2,a5
  64.     cmp.l    (a5),d1
  65.     bne.b    .not1
  66.     cmp.w    #$0100,(4,a5)
  67.     beq.b    .found
  68. .not1
  69.     cmp.l    (a5),d2
  70.     bne.b    .findl
  71.     cmp.w    #$0064,(4,a5)
  72.     bne.b    .findl
  73.  
  74. .found
  75.     move.w    #$4EB9,(a5)+        ;create jsr
  76.  
  77.     ; a0 = ptr to ROM
  78.     ; d0 = rom len
  79.     ; d6 = dosbase
  80.     move.l    d0,d5
  81.     lea    (_rebootfix_module,pc),a1
  82.     jsr    (a3)            ;call _InstallModule
  83.     move.l    d0,d1
  84.     move.l    d5,d0
  85.     tst.l    d1
  86.     beq.b    .nomod
  87.  
  88.     lea    (_name,pc),a1
  89.     jsr    (a2)            ;call _FindResident
  90.     tst.l    d0
  91.     beq.b    .nomod
  92.  
  93.     move.l    d0,a0
  94.     moveq    #_earlycode-_init,d0
  95.     add.l    (RT_INIT,a0),d0
  96.     move.l    d0,(a5)        ; jsr destination
  97.  
  98.  
  99.     moveq    #1,d7
  100. .nomod
  101. .badrom
  102.     move.l    d7,d0
  103.     rts
  104.  
  105.     CNOP    0,4
  106. _rebootfix_module
  107.  BK_MOD BKMF_SingleMode,_end,(0)<<24+37<<16+NT_UNKNOWN<<8+(256-128),_name,_idstr,_init
  108.  
  109. ; Singlemode on,
  110. ; NEVER INIT module, requires KS V37.x or better, module type NT_UNKNOWN, priority -128.
  111.  
  112. _init    rts
  113.  
  114. _earlycode    movem.l    d0/a0,-(sp)
  115.     lea    $dff000+$100,a0
  116.     move.w    #$0200,(a0)        ; Colour burst on!
  117.     moveq    #3,d0
  118.     swap    d0            ; some delay
  119. .loop    move.w    #$0020,($1DC-$100,a0)    ; set PAL
  120.     subq.l    #1,d0
  121.     bne.b    .loop
  122.     movem.l    (sp)+,d0/a0
  123.     rts
  124.  
  125. _name
  126. _idstr    dc.b    'RebootFix patch',0
  127.     CNOP    0,2
  128. _end
  129.  
  130.     SECTION    VERSION,DATA
  131.  
  132.     dc.b    '$VER: RebootFix_PATCH 1.4 (31.1.01)',0
  133.  
  134.